package com.easywb.springboot;

import com.easywb.springboot.config.DBConfig1;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.netflix.hystrix.EnableHystrix;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.web.client.RestTemplate;


@EnableConfigurationProperties(value = {DBConfig1.class})
//@SpringBootApplication
// 开启手动扫包代替SpringBootApplication  优化启动时间
@ComponentScan(
//        扫包范围
        basePackages = {"com.easywb.springboot"},
//        排除不扫描的类
        excludeFilters = {
//                @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, value = View.class)
        }
)
@EnableAutoConfiguration
// 开启多线程异步注解功能
@EnableAsync
@EnableAspectJAutoProxy
@EnableEurekaClient
@EnableFeignClients
@EnableHystrix
//@MapperScan(basePackages = {"com.easywb.springboot.mapper"})
public class SpringbootApplication {
    @Bean
    @LoadBalanced
    public RestTemplate restTemplate() {
        return new RestTemplate();
    }

    public static void main(String[] args) {
        SpringApplication.run(SpringbootApplication.class, args);
    }
}
